package com.yoomiito.app.ui.my.youmi;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yoomiito.app.R;
import com.yoomiito.app.base.App;
import com.yoomiito.app.base.BaseActivity;
import com.yoomiito.app.model.my.YouMI;
import com.yoomiito.app.ui.my.remain.detail.MyMoneyDetailActivity;
import com.yoomiito.app.utils.AllUtils;
import com.yoomiito.app.utils.ImageLoader;
import com.yoomiito.app.widget.TitleView;

import butterknife.BindView;

public class YouMiActivity extends BaseActivity<YouMiPresenter> {

    @BindView(R.id.tv_title)
    TitleView mTitleTv;
    @BindView(R.id.tv_money)
    TextView mYouMiTv;
    @BindView(R.id.tv_title_dec)
    TextView mTitleDesTv;

    @BindView(R.id.tv_des)
    TextView mDesTv;
    @BindView(R.id.youmi_rule)
    ImageView mImageView;
    public static final String YouMi = "youmi";
//    private final String YouMiRule = "https://mimitao-cdn.aijiamai.com/assets/guize4dc9e9dc8d39.png";//旧的
    private final String YouMiRule = "https://mimitao-cdn.aijiamai.com/static/guize@3x(1)(1).png";
    public static void start(Context context){
        Intent intent = new Intent(context,YouMiActivity.class);
        context.startActivity(intent);
    }

    @Override
    public int getLayoutId() {
        return R.layout.act_youmi;
    }

    @Override
    public YouMiPresenter newP() {
        return new YouMiPresenter(App.mAppConfig);
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        mTitleTv.setCenterText("优米");
        mTitleTv.setRightTv("明细");
        mTitleTv.setOnRightClick(view -> MyMoneyDetailActivity.Companion.start(YouMiActivity.this,YouMi,1));
        mTitleDesTv.setText("当前数量");
        mYouMiTv.setTypeface(AllUtils.getTypeface());
        mDesTv.setVisibility(View.GONE);
        ImageLoader.getInstance().into(this,YouMiRule,mImageView);
        getP().getYouBi();
    }

    public void setYouMi(YouMI youMi){
        mYouMiTv.setText(youMi.getCoin());
    }
}
